//
//  TZGGHttpTools.m
//  Village
//
//  Created by 程虎 on 2017/9/19.
//  Copyright © 2017年 程虎. All rights reserved.
//

#import "TZGGHttpTools.h"

@implementation TZGGHttpTools

+ (void)GetTZGGPageNum:(NSInteger )pagenum Success:(void (^)(NSDictionary *valueDict))success failure:(void (^)(NSString *))failure
{
    NSMutableDictionary *bean = [NSMutableDictionary dictionary];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [bean setValue:dict forKey:@"entitybean"];
    [dict setObject:[NSNumber numberWithInteger:5] forKey:@"pagesize"];
    [dict setObject:[NSNumber numberWithInteger:pagenum] forKey:@"pagenum"];
    [dict setObject:[Globle getInstance].account.leapuserid.length > 0 ? [Globle getInstance].account.leapuserid : @"" forKey:@"leapuserid"];
    [NetRequestClass Post:AnnouncementsInfoURL Parameters:bean success:^(id result) {
        
        if (success) {
            success(result[@"data"]);
        }
    } failure:^(id valueCode, id error) {
        if (failure) {
            failure(error);
        }
    }];
}


+ (void)AddTZGGReadingStatusWithArticlesID:(NSString *)articlesID Success:(void (^)())success failure:(void (^)(NSString *))failure
{
    NSMutableDictionary *bean = [NSMutableDictionary dictionary];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [bean setValue:dict forKey:@"entitybean"];
    [dict setObject:articlesID forKey:@"id"];
    [NetRequestClass Post:AddTZGGReadingInfoURL Parameters:bean success:^(id result) {
        
        if (success) {
            success();
        }
    } failure:^(id valueCode, id error) {
        if (failure) {
            failure(error);
        }
    }];
}

+ (void)GetTZGGDetailsPageNum:(NSInteger )pagenum WithArticlesID:(NSString *)articlesID Success:(void (^)(NSDictionary *valueDict))success failure:(void (^)(NSString *))failure
{
    NSMutableDictionary *bean = [NSMutableDictionary dictionary];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [bean setValue:dict forKey:@"entitybean"];
    [dict setObject:articlesID forKey:@"bulletinid"];
    [dict setObject:[NSNumber numberWithInteger:5] forKey:@"pagesize"];
    [dict setObject:[NSNumber numberWithInteger:pagenum] forKey:@"pagenum"];
    [NetRequestClass Post:GetTZGGDetailsInfoURL Parameters:bean success:^(id result) {
        
        if (success) {
            success(result[@"data"]);
        }
    } failure:^(id valueCode, id error) {
        if (failure) {
            failure(error);
        }
    }];
}

+ (void)ReplayTZGGWithModel:(AnnounModel *)model WithReplayStr:(NSString *)replayStr Success:(void (^)(NSArray *))success failure:(void (^)(NSString *))failure
{
    NSMutableDictionary *bean = [NSMutableDictionary dictionary];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [bean setValue:dict forKey:@"entitybean"];
    [dict setObject:model.newsid forKey:@"id"];
    [dict setObject:replayStr forKey:@"bak"];
    [dict setObject:model.bulletinid forKey:@"bulletinid"];
    [dict setObject:[Globle getInstance].account.leapuserid forKey:@"leapuserid"];
    [NetRequestClass Post:ReplayTZGGInfoURL Parameters:bean success:^(id result) {
        
        if (success) {
            success(result[@"data"]);
        }
    } failure:^(id valueCode, id error) {
        if (failure) {
            failure(error);
        }
    }];
}
@end
